
package org.dyndns.cooland.updater.db;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class ConnectionFactory {
	
	private static final String			db_file				= "updater/.settings/updater.db";
	private static ConnectionFactory	connectionFactory	= null;
	
	private ConnectionFactory () {

		try{
			Class.forName("org.sqlite.JDBC");
		}
		catch (ClassNotFoundException e){
			e.printStackTrace();
		}
	}
	
	public Connection getConnection() throws SQLException {

		Connection conn = null;
		conn = DriverManager.getConnection("jdbc:sqlite:" + db_file);
		return conn;
	}
	
	public static ConnectionFactory getInstance() {

		if (connectionFactory == null){
			connectionFactory = new ConnectionFactory();
		}
		return connectionFactory;
	}
	
}
